package org.example.demo1.Controller;

import org.example.demo1.Controller.vo.ResultVO;
import org.example.demo1.entity.Student;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName StudentController
 * @Description TODO
 * @Author Kx
 * @Date 2025/9/9 15:01
 * @Version 1.0
 */
@RestController
public class StudentController extends BaseController{

    /**
     * @author: kx
     * @date: 2025/9/9 15:17
     * @return org.example.demo1.Controller.vo.ResultVO<java.lang.String>
     * @description: 查询所有学生信息
    */
    @PostMapping("/add")
    public ResultVO<String> addStudent(@RequestBody Student student) {
        System.out.println(student.getId());
        System.out.println(student.getName());
        System.out.println(student.getAge());
        return success("添加成功");
    }

    /**
     * @author: kx
     * @date: 2025/9/9 16:25
     * @param id : 学号
     * @return org.example.demo1.Controller.vo.ResultVO<java.lang.String>
     * @description: 删除学生信息
    */
    @PostMapping("/delete")
    public ResultVO<String> deleteStudent(@RequestParam("id") Integer id) {
        System.out.println(id);
        return success("删除成功");
    }

    /**
     * @author: kx
     * @date: 2025/9/9 17:03
     * @param student : 学生信息
     * @return org.example.demo1.Controller.vo.ResultVO<java.lang.String>
     * @description: 修改学生信息
    */
    @PostMapping("/update")
    public ResultVO<String> updateStudent(@RequestBody Student student) {
        System.out.println(student.getId());
        System.out.println(student.getName());
        System.out.println(student.getAge());
        return success("修改成功");
    }

    /**
     * @author: kx
     * @date: 2025/9/9 17:10
     * @return org.example.demo1.Controller.vo.ResultVO<java.lang.String>
     * @description: 查询学生信息
    */
    @GetMapping("/query")
    public ResultVO<String> queryStudent() {
        return success("查询成功");
    }
}
